<template>
  <div>
    <ComponentsTest01
      ref="componentsTest01"
      :name="nameExample"
      @msg="getMsg"
    ></ComponentsTest01>
    <button @click="callLogMsg">print once</button>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import ComponentsTest01 from './components/ComponentsTest01.vue'

const componentsTest01 = ref<InstanceType<typeof ComponentsTest01> | null>(null)

const callLogMsg = () => {
  console.log(componentsTest01.value?.message)
  componentsTest01.value?.logMessage()
}

const nameExample = ref<string>('hello world')

const getMsg = (msg: string) => {
  console.log(msg)
}
</script>
